package com.cr.front.authentication.controller;

import com.cr.common.response.JsonResult;
import com.cr.front.authentication.pojo.dto.AuthenticationSaveParam;
import com.cr.front.authentication.pojo.dto.DriverLicenseSaveParam;
import com.cr.front.authentication.pojo.vo.AuthenticationVO;
import com.cr.front.authentication.pojo.vo.DriverLicenseVO;
import com.cr.front.authentication.service.DriverLicenseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@Api(tags = "驾照验证模块")
@RequestMapping("/users/driverlicense")
public class DriverLicenseController {
    @Autowired
    private DriverLicenseService driverLicenseService;

    @ApiOperation(value = "查询驾照")
    @GetMapping
    public JsonResult getDriverLicenseDetail(){
        DriverLicenseVO driverLicenseVO = driverLicenseService.getDriverLicenseDetail();
        return JsonResult.success(driverLicenseVO);
    }

    @ApiOperation(value = "新增驾照")
    @PostMapping
    public JsonResult addDriverLicense(@Validated @RequestBody DriverLicenseSaveParam driverLicenseSaveParam){
        driverLicenseService.addDriverLicense(driverLicenseSaveParam);
        return JsonResult.success();
    }


}
